repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
10000 - Longest Paths (Grafos, BFS, Dijkstra)
[andmenj-acm.git]
/
11202 - The least possible effort
/
p11202.cpp
blob
eb16228f1ef0f9e2f4bbd8f051768533c4b63638
1
#include <iostream>
2
#include <math.h>
3
4
using namespace
std
;
5
6
int
main
(){
7
unsigned int
t
;
8
cin
>>
t
;
9
while
(
t
--){
10
int
n
,
m
;
11
cin
>>
n
>>
m
;
12
double
x
=
ceil
(
n
/
2.0
),
y
=
ceil
(
m
/
2.0
);
13
if
(
n
!=
m
){
14
cout
<< (
unsigned long
)(
x
*
y
) <<
endl
;
15
}
else
{
16
cout
<< (
unsigned long
)(
x
*
y
- (
x
*(
x
-
1
))/
2.0
) <<
endl
;
17
}
18
}
19
return
0
;
20
}